Rubyplay::Application.routes.draw do

  get "question/new"

  get 'account' => 'account#index'

  get 'admin' => 'admin#index'

  controller :sessions do
    get 'login' => :new
    post 'login' => :create
    get 'logout' => :destroy
  end

    
  get "admin/index"

  get "sessions/new"

  get "sessions/create"

  get "sessions/destroy"
  
  get "overdue/fine"

  get "introduce/new"
  #get "products/searchName"


  scope "(:locale)", :locale => /en|vi/ do
    match 'home' => 'home#index'
    match 'introduce/new' => 'introduce#new'
    match 'equipe' => 'equipe#index'

    match 'mandats' => 'mandats#index'
  end


  #match "/products/require" => "products#require"
  #match "/products/require_1" => "products#require_1"
  #get "products/require"
  scope '(:locale)' do
  controller:products do
    get 'products/require' => :require
    post 'products/require' => :require_post


    get 'products/search/NameOfDrink' => :searchDrink
    post 'products/search/NameOfDrink' => :searchDrink

  end

  controller:users do
    get 'users/search' => :search
    post 'users/search' => :search
  
    get 'users/reset' => :reset
    post 'users/reset' => :reset_pass

   get 'users/feedback' => :feedback
    post 'users/feedback' => :feedback_post
  
  end

  
  controller:borrowedtables do
    get 'borrowedtables/paybook' => :paybook
    post 'borrowedtables/pay' => :pay
  end
  controller:borrowedtables do
    get  'borrowedtables/extension' => :extension
    post 'borrowedtables/ex' => :ex
    
    get  'borrowedtables/registration' => :registration
    post 'borrowedtables/registration' => :registration_post
  end


#index
  controller :contact do
    get  'contact' => :new
    post 'contact' => :new
  end

  controller :staff do
    get 'staff' => :new
    post 'staff' => :new
  end
  
  controller :news do
    get 'news' => :new
    post 'news' => :new
  end

  controller :introduce do
    get 'introduce' => :new
    post 'introduce' => :new
  end

  controller :help do
    get 'help' => :new
    post 'help' => :new
  end
  
  controller :question do
    get 'question' => :new
    post 'question' => :new
  end
end
#end index

#multi language
  scope '(:locale)' do
    resources :users

    resources :product_images

    resources :products

    resources :history_users

    resources :groupusers

    resources :categories

    resources :borrowedtables

    root :to => "home#index"
  end
 
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products


  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end
  
  
  
  
  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
end
